/*******************************************************************************
*  file    : testdatadialog.cpp
*  created : 07.07.2012
*  author  : Slyshyk Oleksiy (alex312@meta.ua)
*******************************************************************************/

#include "testdatadialog.hpp"
#include "ui_testdatadialog.h"
#include <QStringListModel>

TestDataDialog::TestDataDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::TestDataDialog)
{
    ui->setupUi(this);
    model_ = new QStringListModel(this);
    ui->listView->setModel(model_);
}

TestDataDialog::~TestDataDialog()
{
    delete ui;
}

void TestDataDialog::setList(const QStringList &list)
{
    model_->setStringList(list);
}

QString TestDataDialog::getSelected()
{
    QString res;
    QModelIndexList sel = ui->listView->selectionModel()->selectedIndexes();
    if(sel.size())
        res = model_->data(sel.at(0),Qt::DisplayRole).toString();
    return res;
}

